import { createApp } from 'vue'
import {
  ActionBar,
  ActionBarIcon,
  ActionBarButton,
  Divider,
  Popup,
  Overlay,
  Loading,
  Dialog,
  ContactCard,
  Form,
  AddressEdit,
  AddressList,
  Field,
  CellGroup,
  Cell,
  SwipeCell,
  Icon,
  Stepper,
  Card,
  Checkbox,
  CheckboxGroup,
  Button,
  Swipe,
  SwipeItem,
  PullRefresh,
  List,
  Tab,
  Tabs,
  SubmitBar,
  Toast,
  Tabbar,
  TabbarItem,
  Image as VanImage,
  NoticeBar,
  Tag,
  ImagePreview,
  Collapse,
  CollapseItem,
  Sidebar,
  SidebarItem,
  Switch,
  Empty,
  Grid,
  GridItem,
  NavBar,
  RadioGroup,
  Radio,
  Calendar,
  DatetimePicker,
  ActionSheet
} from 'vant'

import App from './App.vue'
import router from './router'
import 'lib-flexible/flexible'
import 'vant/lib/index.css'; // 全局引入样式
import '../src/assets/style/base.css'; // 全局引入base样式

const app = createApp(App) // 创建实例

// 全局过滤器
app.config.globalProperties.$filters = {
  prefix(url) {
    return url && url.startsWith('http') ? url : `http://47.99.134.126:28019${url}`
    // if (url && url.startsWith('http')) {
    //   return url
    // } else {
    //   url = `http://47.99.134.126:28019${url}`
    //   return url
    // }
  }
}

app.use(ActionBarButton)
  .use(ActionBarIcon)
  .use(ActionBar)
  .use(Divider)
  .use(Popup)
  .use(Overlay)
  .use(Loading)
  .use(Dialog)
  .use(Toast)
  .use(ContactCard)
  .use(Form)
  .use(AddressEdit)
  .use(AddressList)
  .use(Field)
  .use(CellGroup)
  .use(Cell)
  .use(SwipeCell)
  .use(Icon)
  .use(Stepper)
  .use(Card)
  .use(Button)
  .use(Swipe)
  .use(SwipeItem)
  .use(PullRefresh)
  .use(List)
  .use(Tab)
  .use(Tabs)
  .use(SubmitBar)
  .use(Checkbox)
  .use(CheckboxGroup)
  .use(Tabbar)
  .use(TabbarItem)
  .use(VanImage)
  .use(NoticeBar)
  .use(Tag)
  .use(ImagePreview)
  .use(Collapse)
  .use(CollapseItem)
  .use(Sidebar)
  .use(SidebarItem)
  .use(Switch)
  .use(Empty)
  .use(Grid)
  .use(GridItem)
  .use(NavBar)
  .use(Radio)
  .use(RadioGroup)
  .use(Calendar)
  .use(DatetimePicker)
  .use(ActionSheet)

app.use(router)
// app.use(store)

app.mount('#app')